package com.trianglman.shoppersAide;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class list extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);
	    ListView lv = (ListView) findViewById(R.id.ListView01);
	    LinearLayout listFooter = (LinearLayout) getLayoutInflater().inflate(R.layout.add_list_item,null);
	    lv.addFooterView(listFooter);
	    lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, COUNTRIES));
	    lv.setOnItemClickListener(new OnItemClickListener() {
	      public void onItemClick(AdapterView<?> parent, View view,
	        int position, long id) {
	        // When clicked, show a toast with the TextView text
	        Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
	        Toast.LENGTH_SHORT).show();
	      }
	    });
    }

    static final String[] COUNTRIES = new String[] {
        "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
      };

    @Override
	public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }

}